package com.yuyou.tas.report.service.impl;

import com.yuyou.tas.report.mapper.ExamModelWordPassMapper;
import com.yuyou.tas.report.service.IExamModelWordPassService;
import com.yuyou.tas.service.api.report.entity.ExamModelWordPass;
import com.yuyou.tas.util.bean.ResBoolSimpleInfo;
import com.yuyou.tas.util.tool.Sequence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;

@Service
public class ExamModelWordPassServiceImpl implements IExamModelWordPassService{

	@Autowired
	private ExamModelWordPassMapper examModelWordPassMapper;
	
	@Override
	public int deleteByPrimaryKey(Long id) {
		return examModelWordPassMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(ExamModelWordPass record) {
		record.setId(Sequence.getSequence().nextId());
		record.setCreateTime(new Date());
		return examModelWordPassMapper.insert(record);
	}

	@Override
	public ExamModelWordPass selectByPrimaryKey(Long id) {
		return examModelWordPassMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(ExamModelWordPass record) {
		return examModelWordPassMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public ResBoolSimpleInfo<String> add(ExamModelWordPass record) {
		this.insert(record);
		return ResBoolSimpleInfo.getSuccessInfo();
	}

	@Override
	public void delByWordId(Long examModelWordId) {
		examModelWordPassMapper.delByWordId(examModelWordId);
	}

	@Override
	public ExamModelWordPass getByScore(Long examId, BigDecimal score) {
		return examModelWordPassMapper.getByScore(examId , score);
	}

}